import * as types from './mutations-type'
import {
  locationGet,
  locationSet,
  sessionClean
} from 'common/js/cache'
export function saveAdminInfo({
  commit,
  state
}, key) {
  commit(types.SET_ADMIN_INFO, locationGet(key))
}

export function reLogin({
  commit,
  state
}) {
  // sessionClean()
  commit(types.SET_RE_LOGIN, true)
}

export function getNavTitleList({
  commit,
  state
}, list) {
  // console.log('提交了')
  commit(types.SET_NAV_TITLE_LIST, list)
}

// export function delNavTitleList({
//   commit,
//   state
// }, route) {
//   commit(types.REMOVE_NAV_TITLE_LIST, route)
// }


// 添加动态路由
export function addRouters({
  commit,
  state
}, list) {
  if(!list){
    list = locationGet('routes')||[]
  }
  commit(types.SET_ROUTER, list)
}